package com.lsj.controller;

import com.lsj.entity.User;
import com.lsj.es.UserDao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class UserController {

    @Autowired
    UserDao userDao;

    @PostMapping("/addUser")
    public User addUser(@RequestBody User user){
        return userDao.save(user);
    }


    @GetMapping("/getUserById")
    public User getUser(String id){
        return userDao.findById(id).get();
    }
}
